<?php
/**
 * Created by PhpStorm.
 * User: zoupeng
 * Date: 2019-02-21
 * Time: 20:13
 */

namespace app\index\model;

use think\exception\ErrorException;
use think\Log;
use think\Model;
class Banner extends Model
{
    /**
     * Banner列表
     * @return false|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function findBannerList(){

        try{
            $BannerList = $this->where('show',1)
                ->where('endTime', '>=', time())
                ->order('id asc')
                ->select();
            return $BannerList;
        }catch (ErrorException $e){
            Log::write('查询异常、错误：'.$e->getMessage(),'error');
        }
    }
}